import React, { useState, useEffect } from 'react'
import axios from 'axios'
export default function Film() {
    const [list, setList] = useState([])
interface IItem {
    name: string,
    filmId: number
}

    useEffect(()=>{
        axios({
            url:"https://m.maizuo.com/gateway?cityId=110100&pageNum=1&pageSize=10&type=1&k=1886067",
            headers:{
                'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.2.0","e":"16395416565231270166529","bc":"110100"}',
                'X-Host': 'mall.film-ticket.film.list'
            }
        }).then(res=>{
            console.log(res.data.data.films)
            setList(res.data.data.films)
        })
    }, [])

    return (
        <div>
            <ul>
                {
                  list.map((item: IItem) => {
                    return (
                        <li key={item.filmId}>{item.name}</li>
                    )
                  })
                }
            </ul>
            
        </div>
    )
}
